home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
public
/
bit
/
src
/
mpeg
/
mpeg_driver.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-01
|
2KB
|
100 lines
/***************************************************************
*. This file is part of BIT shareware package.
*
* Copyright(c) 1993, 1994 by T.C. Zhao.
* All rights reserved.
*.
*
*************************************************************/
#include "video.h"
#include "proto.h"
#include <stdlib.h>
#include <sys/types.h>
#include <signal.h>
#include "util.h"
#include "dither.h"
#define BUF_LENGTH 80000 /* Define buffer length. */
FILE *input; /* Global file pointer to incoming data. */
int EOF_flag = 0; /* End of File flag. */
int loopFlag; /* Loop flag. */
int quietFlag; /* Quiet flag. */
int noDisplayFlag; /* Display image on screen? */
jmp_buf errjmp;
jmp_buf env;
int seek_only;
int ditherType = FULL_COLOR_DITHER;
void
frame_re_init(void)
{
EOF_flag = 0;
curBits = 0;
bitOffset = 0;
bufLength = 0;
bitBuffer = NULL;
}
void
set_mpeg_seek(int y)
{
seek_only = y;
}
void
mpeg_system_init(void)
{
static mpegsysinit;
if (!mpegsysinit)
{
LUM_RANGE = 8;
CR_RANGE = CB_RANGE = 4;
lum_values = (int *) malloc(LUM_RANGE * sizeof(int));
cr_values = (int *) malloc(CR_RANGE * sizeof(int));
cb_values = (int *) malloc(CB_RANGE * sizeof(int));
ditherType = FULL_COLOR_DITHER;
init_tables();
InitColorDither();
}
mpegsysinit = 1;
}
void
set_video_stream(FILE * fp)
{
input = fp;
}
static VidStream *theStream;
VidStream *
mpeg_next_frame(int n)
{
/** All library error will end up here **/
if (setjmp(errjmp))
{
fputs("Bad mpeg stream\n", stderr);
return 0;
}
if (n == 0)
{
theStream = NewVidStream(BUF_LENGTH);
mpeg_system_init();
return mpegVidRsrc(0, theStream);
}
return mpegVidRsrc(0, theStream);
}